﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.CMS.Bll;
using Runda.CMS.Common.Entity;
using Runda.CMS.Common.Utility;
using System.Collections.Generic;
using Telerik.WebControls;


namespace Runda.CMS.Portal.SyncManage
{
    public partial class InstrumentAccessory : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                if (Request.QueryString["InstrumentID"] != null) {
                    List<WsmAccessoryInfoEntity> list = new SystemBll().GetAll<WsmAccessoryInfoEntity>(" and AccessoryID in (select AccessoryID from Cms_Wsm_AccessoryInInstrument where InstrumentID='" + Request.QueryString["InstrumentID"] + "')");
                    gridContractItems.DataSource = list;
                    gridContractItems.DataBind();
                    hiddenInstrumentID.Value = Request.QueryString["InstrumentID"];
                }
            }
        }

        protected void gridContractItems_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == Telerik.WebControls.GridItemType.Item || e.Item.ItemType == Telerik.WebControls.GridItemType.AlternatingItem)
            {
                Label AccessoryType = e.Item.FindControl("AccessoryType") as Label;
                Label AccessoryTypeName = e.Item.FindControl("AccessoryTypeName") as Label;

                AccessoryTypeName.Text = AccessoryType.Text == "1" ? "配件" : "易耗件";


            }
        }
    }
}
